package com.aichongbang.acb.service.impl;

import com.aichongbang.acb.po.Item;
import com.aichongbang.acb.mapper.ItemMapper;
import com.aichongbang.acb.service.IItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author acb
 * @since 2021-05-27
 */
@Service("itemService")
public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements IItemService {
    @Resource
    private ItemMapper itemMapper;

    @Override
    public List<Item> getAllItems() {
        return itemMapper.getAllItems();
    }

    @Override
    public List<Item> queryItems(Item item) {
        List<Item> list = itemMapper.queryItems(item);
        return list;
    }

    @Override
    public Integer addItem(Item item) {
        return itemMapper.addItem(item);
    }

    @Override
    public Item getItemById(Integer tId) {
        return itemMapper.getItemById(tId);
    }

    @Override
    public boolean updateItem(Item item) {
        int n = itemMapper.updateById(item);
        return n > 0 ? true : false;
    }

    @Override
    public boolean deletedItem(Integer tId) {
        int n = itemMapper.deleteById(tId);
        return n > 0 ? true : false;
    }
}
